package ar.com.jsejtman.common.security.schema.service;

import ar.com.jsejtman.common.persistence.exception.DaoException;
import ar.com.jsejtman.common.security.schema.dao.DomainActionDao;
import ar.com.jsejtman.common.security.schema.entity.DomainAction;
import ar.com.jsejtman.common.service.definition.BaseService;
import ar.com.jsejtman.common.service.exception.EntitySavingException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * Permite manipular acciones de dominio.
 * 
 * @author jsejtman
 */
@Service
@Transactional
public class DomainActionService extends BaseService implements IDomainActionService {

	@Override
	public final Long saveDomainAction(final DomainAction domainAction)
	        throws EntitySavingException {

		try {
			final DomainActionDao dao = this.getDaoFactory().newDao(DomainActionDao.class);

			return (dao.save(domainAction));

		} catch (final DaoException e) {
			throw new EntitySavingException(e.getMessage(), e);
		}
	}
}
